from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, String, create_engine, Integer
from sqlalchemy.orm import sessionmaker

Base = declarative_base()

TITLE_LEN = 100
LINK_LEN = 200
WORD_LEN = 30
SITE_LEN = 30

class modelCategory(Base):
    
    __tablename__ = 'category'
    title = Column(String(TITLE_LEN), primary_key=True)
    link = Column(String(LINK_LEN))
    
    def __str__(self):
        return 'title={}, link={}'.format(self.title, self.link)



class modelLink(Base):
    
    __tablename__ = 'link'
    title = Column(String(TITLE_LEN), primary_key=True)
    link = Column(String(LINK_LEN))

    def __str__(self):
        return 'title={}, link={}'.format(self.title, self.link)

class modelDeletedcategory(Base):

    __tablename__ = 'deletedcategory'
    link = Column(String(LINK_LEN), primary_key=True)

    def __str__(self):
        return 'link={}'.format(self.link)
class modelDoneLink(Base):

    __tablename__ = 'donelink'
    link = Column(String(LINK_LEN), primary_key=True)
    def __str__(self):
        return 'link={}'.format(self.link)
        
class modelHtmlText(Base):

    __tablename__ = 'htmltext'
    id = Column(Integer(), primary_key=True)
    site = Column(String(WORD_LEN)) 
    text = Column(String())

    def __str__(self):
        return 'site={},text={}'.format(self.site, self.text)


class modelWordCount(Base):
    __tablename__ = 'wordcount'
    word = Column(String(WORD_LEN), primary_key=True)
    count = Column(Integer())
    trans = Column(String())

    def __str__(self):
        return 'word={},count={},trans={}'.format(self.word, self.count,self.trans)
    